package acceptanceTests.promoteUser;

import server.ForumServer;

public class PromoteUserImp implements PromoteUserInt {

	private boolean _implementedPromote = true;
	private boolean _implementedIsModerator = true;
	private boolean _implementedIsAdmin = true;
	private boolean _implementedSetAdmin = false;

	private ForumServer _server;

	public PromoteUserImp(ForumServer server){
		this._server = server;
	}


	public boolean Promote(String admin, String member) {
		this._server.getUserRepository().changeRank(member, 1);
		return true;
	}

	public boolean is_implementedPromote() {
		return _implementedPromote;
	}

	public boolean is_implementedIsModerator() {
		return _implementedIsModerator;
	}

	public boolean is_implementedIsAdmin() {
		return _implementedIsAdmin;
	}

	public boolean is_implementedSetAdmin() {
		return _implementedSetAdmin;
	}

	public boolean isAdmin(String user) {
		return (this._server.getUserRepository().getUser(user)._rank==3);
	}

	public boolean isModerator(String user) {
		return (this._server.getUserRepository().getUser(user)._rank==2);
	}

	public boolean setAdmin(String user) {
		return false;
	}

}
